<?php
/**
 * 材质管理
 * @author Ice iceinto@mallog.com.cn
 */
class MaterialModel extends BaseModel
{
    //自动验证
    protected $_validate = array(
        array('m_name', 'require', '名称必须！'), 
        array('m_name','','名称已经存在！',0,'unique',3), 
    );
    public function getMaterial ($map = array(), $more = false, $field = '*', $limit = '', $order = '')
    {
        if ($more) {
            return $this->where($map)
                ->field($field)
                ->order($order)
                ->limit($limit)
                ->findAll();
        } else {
            return $this->where($map)
                ->field($field)
                ->order($order)
                ->limit($limit)
                ->find();
        }
    }
}